using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SmartLink.Domain.Entity;
using SmartLink.Domain.IServices;
using SmartLink.IRepository;
using SmartLink.Repository;

namespace SmartLink.Domain.Services
{
    public class SYS_MenuServices : ISYS_MenuServices
    {
        private ISYS_MenuRepo _isysMenuRepo;
        public SYS_MenuServices(ISYS_MenuRepo isysMenuRepo)
        {
            this._isysMenuRepo = isysMenuRepo;
        }

        public SYS_MenuServices()
        {

        }

        public IList<SYS_Menu> GetMenusByIds(IList<int> menuIds)
        {
            return _isysMenuRepo.GetMenusByIds(menuIds);
        }

        public IList<SYS_Menu> GetAllMenus()
        {
            return _isysMenuRepo.GetAllMenus();
        }

        public void Add(SYS_Menu menu)
        {
            _isysMenuRepo.AddMenu(menu);
        }

        public bool Delete(int menuId)
        {
            return _isysMenuRepo.Delete(menuId);
        }

        public bool Update(SYS_Menu menu)
        {
            return _isysMenuRepo.Update(menu);
        }

        public bool CheckExistByMenuUrl(string menuUrl)
        {
            return _isysMenuRepo.CheckExistByFiled("Url", menuUrl, "SYS_Menu");
        }


        public bool CheckExistSameLevelMenuByMenuName(int pId,string menuName)
        {
            return _isysMenuRepo.CheckExistSameLevelMenuByMenuName(pId, menuName);
        }

        public SYS_Menu GetSingleMenu(int menuId)
        {
            return _isysMenuRepo.GetById(menuId);
        }

        public SYS_Menu GetMaxSortMenuByParentId(int pid)
        {
            return _isysMenuRepo.GetMaxSortMenuByParentId(pid);
        }

        public IList<int> GetUserMenuIds(int userId)
        {
            return _isysMenuRepo.GetUserMenuIds(userId);
        }

        public IList<int> GetRoleMenuIds(int RoleId)
        {
            return _isysMenuRepo.GetRoleMenuIds(RoleId);
        }


    }
}
